<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly ="Ngilead.Test.Resources" namespace="Ngilead.Test.Models.Stateless">
  <class name="User" table="users">
    <id name="Id" column="iduser" type="System.Int64">
      <generator class="native"/>
    </id>
    <version name="Version"     column="version"      type="System.Int32"/>
    
		<property name="Login"      column="login"        type="System.String"      length="45"     not-null="true" unique="true" />
		<property name="FirstName"  column="firstname"    type="System.String"      length="45"     not-null="true" />
		<property name="LastName"   column="lastname"     type="System.String"      length="45"     not-null="true" />
		<property name="Password"   column="password"      type="System.String"      length="45" />

    <many-to-one name="Gender"  class="Gender"/>
    
		<set name="MessageList" inverse="true" cascade="all, delete-orphan">
			<key column="iduser" not-null="true" />
			<one-to-many class="Message" />
		</set>

    <bag name="GroupList" table="user_group" cascade="save-update, delete-orphan">
			<key column="iduser" />
			<many-to-many class="Group" column="idgroup" />
		</bag>
		
    <!-- Embedded address -->    
		<component name="Address" class="Address">
			<property name="Street"     column="street"     type="System.String"      length="45"     not-null="true" />
			<property name="City"       column="city"       type="System.String"      length="45"     not-null="true" />
			<many-to-one name="Country" cascade="save-update" class="Country"/>
		</component>		
    
    <!-- Subclass -->
		<joined-subclass name="Employee">
			<key column="idemployee" />
			<property name="Email"      column="email"      type="System.String"      length="45" />
		</joined-subclass>
	</class>
</hibernate-mapping>
